
/****** Object:  Table [dbo].[LullabyNota]    Script Date: 01/17/2013 23:52:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[LullabyNota](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[IdUsuariCreador] [int] NOT NULL,
	[IdHostalDesti] [int] NULL,
	[IdUsuariDesti] [int] NULL,
	[Data] [date] NOT NULL,
	[DataCaducitat] [date] NOT NULL,
	[Text] [varchar](max) NOT NULL,
 CONSTRAINT [PK_LullabyNota] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[LullabyNota]  WITH CHECK ADD  CONSTRAINT [FK_LullabyNota_LullabyHostal] FOREIGN KEY([IdHostalDesti])
REFERENCES [dbo].[LullabyHostal] ([Id])
GO

ALTER TABLE [dbo].[LullabyNota] CHECK CONSTRAINT [FK_LullabyNota_LullabyHostal]
GO

ALTER TABLE [dbo].[LullabyNota]  WITH CHECK ADD  CONSTRAINT [FK_LullabyNota_LullabyNota] FOREIGN KEY([IdUsuariCreador])
REFERENCES [dbo].[LullabyUsuari] ([Id])
GO

ALTER TABLE [dbo].[LullabyNota] CHECK CONSTRAINT [FK_LullabyNota_LullabyNota]
GO

ALTER TABLE [dbo].[LullabyNota]  WITH CHECK ADD  CONSTRAINT [FK_LullabyNota_LullabyUsuari] FOREIGN KEY([IdUsuariDesti])
REFERENCES [dbo].[LullabyUsuari] ([Id])
GO

ALTER TABLE [dbo].[LullabyNota] CHECK CONSTRAINT [FK_LullabyNota_LullabyUsuari]
GO


